top_dir=.
top_srcdir=.
base=$(shell pwd)
data=$(base)/data
src=$(top_dir)/src
srcs=$(wildcard src/*.cpp)
objects=$(shell ls src/*.cpp | sed -re 's/.cpp/.o/g')

target=libhl7pp.so
includedir=$(top_dir)/include
includes=$(shell find include -name '*.h' -exec basename '{}' \;)

CXXFLAGS=-I$(includedir) -Wall -O2 -g3 -dA
LDFLAGS=-Wall -lpcre -lpcre++ --shared

INSTALL_DIR=/usr/local/lib
INCLUDE_INSTALL_DIR=/usr/local/include

include $(wildcard *.mk)

all: $(objects) $(target)

$(target): $(objects)
	@echo [$(target)]
	$(CXX) $(CFLAGS) $(LDFLAGS) -o $(target) $(objects)

clean:
	-rm -f $(target) $(src)/*.o core

tags:
	@ctags -a -R --c++-kinds=+p --fields=+iaS --extra=+q .

install: $(target)
	@echo [install]
	cp $(target) $(INSTALL_DIR)

uninstall:
	@echo [uninstall]
	rm  $(INSTALL_DIR)/$(target)


include $(wildcard src/*.mk)
